package com.bristua.mall.order.controller;

import com.bristua.mall.common.bean.Result;
import com.bristua.mall.common.utils.HandleResultUtil;
import com.bristua.mall.order.biz.CancelOrderBiz;
import com.bristua.mall.order.enums.OrderCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2019/3/24.
 */
@RestController
@Api(value="取消订单",tags={"取消订单"})
public class CancelOrderController {

    @Autowired
    private CancelOrderBiz cancelOrderBiz;

    @ApiOperation(value="取消订单")
    @PostMapping("/api/order/cancel/{orderId}")
    public Result cancelOrder(@PathVariable(value = "orderId") String orderId){
        cancelOrderBiz.cancelOrder(orderId);
        return HandleResultUtil.commonResult(OrderCode.CANCEL_ORDER_SUCCESS.getCode(),OrderCode.CANCEL_ORDER_SUCCESS.getMsg());
    }
}
